package com.grass.cropTradingCenter.domain;

import com.grass.cropTradingCenter.common.BusinessException;
import com.grass.cropTradingCenter.common.ResultCode;
import com.grass.cropTradingCenter.service.domain.UserDomainService;
import com.grass.cropTradingCenter.utils.SecurityUtils;
import org.springframework.stereotype.Service;

@Service
public class UserDomainServiceImpl implements UserDomainService {
    public int getLoginUser() {
        int userId = SecurityUtils.getUserId();
        if (userId == 0) {
            throw new BusinessException(ResultCode.NO_LOGIN);
        }
        return userId;
    }
}
